package com.cheng.example.geektime.designpatterns.j22.v2;

public class HtmlDownloader {
    private NetworkTransporter transporter;//通过构造函数或IOC注入

//    public Html downloadHtml(String url) {
//        Byte[] rawHtml = transporter.send(new HtmlRequest(url));
//        return new Html(rawHtml);
//    }


    // HtmlDownloader这里也要有相应的修改
    public Html downloadHtml(String url) {

        HtmlRequest htmlRequest = new HtmlRequest(url);

        //得到地址，得到字节
        Byte[] rawHtml = transporter.send(htmlRequest.getAddress(), htmlRequest.getContent());

        return new Html(rawHtml);
    }
}

